<template>
	<view>
		<cu-custom bgColor="bg-white" :isBack="true">
			<block slot="content">宿舍信息</block>
			<block slot="right">
				<image @click="showFun" class="nav-right-image" src="@/static/images/nav_opt.png"></image>
			</block>
		</cu-custom>

		<view class="page-content" :style="{height:this.ContentArea+'px',paddingTop:'30rpx'}">
			<view class="page-search">
				<view class="search">
					<view class="search-left" @click="searchBtn">
						<image src="@/static/images/search.png" mode="aspectFit" />
					</view>
					<input class="search-center" type="text" placeholder="输入任意字段进行搜索"
						placeholder-class="search-placeholder" v-model="searchValue">
				</view>
			</view>

			<view class="page-content-main">
				<view class="select-box">
					<view class="select">
						<view class="cu-form-group">
							<view class="title"></view>
							<picker @change="bindPickerChange" :value="index" :range="array">
								<view class="picker">
									{{index>-1?array[index]:'请选择'}}
								</view>
							</picker>
						</view>
						<view class="select-icon">
							<image src="@/static/images/downArrow.png" mode="aspectFit" />
						</view>
					</view>
					<view class="select">
						<view class="cu-form-group">
							<view class="title"></view>
							<picker @change="bindPickerChangeTwo" :value="indexTwo" :range="arrayTwo">
								<view class="picker">
									{{indexTwo>-1?arrayTwo[indexTwo]:'请选择'}}
								</view>
							</picker>
						</view>
						<view class="select-icon">
							<image src="@/static/images/downArrow.png" mode="aspectFit" />
						</view>
					</view>
					<view class="select">
						<view class="cu-form-group">
							<view class="title"></view>
							<picker @change="bindPickerChangeTree" :value="indexTree" :range="arrayTree">
								<view class="picker">
									{{indexTree>-1?arrayTree[indexTree]:'请选择'}}
								</view>
							</picker>
						</view>
						<view class="select-icon">
							<image src="@/static/images/downArrow.png" mode="aspectFit" />
						</view>
					</view>
					<view class="select">
						<view class="cu-form-group">
							<view class="title"></view>
							<picker @change="bindPickerChangeFour" :value="indexFour" :range="arrayFour">
								<view class="picker">
									{{indexFour>-1?arrayFour[indexFour]:'请选择'}}
								</view>
							</picker>
						</view>
						<view class="select-icon">
							<image src="@/static/images/downArrow.png" mode="aspectFit" />
						</view>
					</view>
				</view>

				<view v-for="(item,index) in dataList" class="boxList" @click="toDetails">
					<view>
						<text style="font-weight: bold;font-size: 16px;">
							{{item.title}}
						</text>
					</view>
					<view style="display: flex;margin-top: 8px;">
						<view>
							<view class="textClass">
								<text class="listText">
									所在楼栋：{{item.building}}
								</text>
							</view>
							<view class="textClass">
								<text class="listText">
									宿舍属性：{{item.dormitoryProperties}}
								</text>
							</view>
							<view class="textClass">
								<text class="listText">
									可住人数：{{item.habitable}}
								</text>
							</view>
						</view>
						<view style="margin-left: 60px;">
							<view class="textClass">
								<text class="listText">
									所在楼层：{{item.floor}}
								</text>
							</view>
							<view class="textClass">
								<text class="listText">
									宿舍号：{{item.dormitoryNumber}}
								</text>
							</view>
							<view class="textClass">
								<text class="listText">
									已住人数：{{item.resided}}
								</text>
							</view>
						</view>
					</view>
				</view>

			</view>

		</view>

		<view class="fun-wrap" v-show="isShowFun" @click="hideFun">
			<view class="fun-box" :style="{top:this.CustomBar+'px'}">
				<view class="fun-item" @click.stop="gotoAdd">
					<image class="fun-icon" src="@/static/images/addIcon.png" />
					<text class="fun-text">新增</text>
				</view>
				<view class="fun-item" @click="importBtn">
					<image class="fun-icon" src="@/static/images/importIcon.png" />
					<text class="fun-text">导入</text>
				</view>
				<view class="fun-item" @click="exportBtn">
					<image class="fun-icon" src="@/static/images/exportIcon.png" />
					<text class="fun-text">导出</text>
				</view>
				<view class="fun-item" @click="draftBatchBtn">
					<image class="fun-icon" src="@/static/images/draftIcon.png" />
					<text class="fun-text">草稿箱</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import moment from 'moment';
	export default {
		data() {
			return {
				index: 0,
				array: ['公司'],
				indexTwo: 0,
				arrayTwo: ['楼栋'],
				indexTree: 0,
				arrayTree: ['楼层'],
				indexFour: 0,
				arrayFour: ['1人','2人', '3人'],
				searchValue: '',
				dataList: [{
					title: '福建省立华智纺科技',
					building: '1#栋',
					floor: '一层',
					dormitoryProperties: '空房',
					dormitoryNumber: '1233',
					habitable:'4',
					resided:'2',
				},{
					title: '福建省立华智纺科技1',
					building: '1#栋',
					floor: '一层',
					dormitoryProperties: '空房',
					dormitoryNumber: '1233',
					habitable:'4',
					resided:'2',
				},{
					title: '福建省立华智纺科技1',
					building: '1#栋',
					floor: '一层',
					dormitoryProperties: '空房',
					dormitoryNumber: '1233',
					habitable:'4',
					resided:'2',
				},{
					title: '福建省立华智纺科技1',
					building: '1#栋',
					floor: '一层',
					dormitoryProperties: '空房',
					dormitoryNumber: '1233',
					habitable:'4',
					resided:'2',
				}],
				isShowFun: false,
				refreshing: true,
				pageSize: 10,
				pageNo: 1,
				total: 0,
				listUrl: ''
			}
		},
		mounted() {

		},
		computed: {
			createTimeShow: function() {
				return moment(this.createTime).isValid() ? moment(this.createTime).format('MM-DD') : moment().format('MM-DD')
			}
		},
		methods: {
			searchBtn() {
				console.log(this.searchValue)
			},
			clearSearch() {
				this.searchValue = ''
			},
			bindPickerChange(e) {
				this.index = e.detail.value
			},
			bindPickerChangeTwo(e) {
				this.indexTwo = e.detail.value
			},
			bindPickerChangeTree(e) {
				this.indexTree = e.detail.value
			},
			bindPickerChangeFour(e) {
				this.indexFour = e.detail.value
			},
			showFun() {
				this.isShowFun = true
			},
			hideFun() {
				this.isShowFun = false
			},
			toDetails(){
				uni.navigateTo({
					url: '/pages/dormitory/dormitoryDetails/index'
				})
			},
			gotoAdd() {
				// uni.navigateTo({
				// 	url: '/pages/dormitory/dormitoryAdd/index'
				// })
			},
			deleteBtn() {
				console.log('删除')
			},
			importBtn() {
				console.log('导入')
			},
			exportBtn() {
				console.log('导出')
			},
		}
	}
</script>

<style lang="scss" scoped>
	image {
		width: 100%;
		height: 100%;
	}

	.blackList {
		height: 100%;
		overflow: hidden;
	}

	.page-search {
		padding-left: 34rpx;
		margin-bottom: 12rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
	}

	.search {
		width: 680rpx;
		height: 86rpx;
		background-color: rgba(249, 249, 249, 1);
		border-radius: 60rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		padding-left: 24rpx;
		padding-right: 24rpx;

		.search-left {
			width: 28rpx;
			height: 28rpx;
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.search-center {
			margin-left: 22rpx;
		}

		.search-placeholder {
			font-size: 28rpx;
			font-weight: 400;
			color: #7C7C7C;
		}


	}

	.filter-btn {
		width: 40rpx;
		height: 40rpx;
		margin-right: 42rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.page-content-main {
		height: calc(100% - 12rpx - 86rpx);
		border-top-left-radius: 64rpx;
		border-top-right-radius: 64rpx;
		padding: 26rpx 34rpx 0 34rpx
	}

	.select-box {
		display: flex;
		flex-direction: row;
		justify-content: flex-start;

	}

	.select {
		width: 160rpx;
		height: 74rpx;
		border-radius: 60rpx;
		background-color: #4591FE;
		margin-bottom: 20rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		margin-right: 28rpx;
		position: relative;

    .select-value {
      font-size: 28rpx;
      font-weight: 400;
      color: #FFFFFF;
      margin-right: 18rpx;
    }

    .select-icon {
      width: 22rpx;
      height: 22rpx;
      display: flex;
      justify-content: center;
      align-items: center;
      position: absolute;
      right: 20rpx;
      top:25rpx;
    }
	}

	.list {
		height: calc(100% - 74rpx - 20rpx);
	}

	.list-item {
		border-radius: 28rpx;
		background-color: #FFFFFF;
		padding: 26rpx 24rpx 28rpx 20rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		margin-bottom: 26rpx;
		position: relative;

		.list-item-leftCenter {
			display: flex;
			flex-direction: row;
		}

		.list-item-left {
			width: 86rpx;
			height: 86rpx;
			margin-right: 26rpx;
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.list-item-center {
			.list-item-row {
				display: flex;
				flex-direction: row;
				margin-bottom: 20rpx;

				.list-item-name {
					color: #101317;
					font-size: 32rpx;
					margin-right: 16rpx;
				}

				.list-item-sex {
					width: 106rpx;
					height: 42rpx;
					border-top-right-radius: 40rpx;
					border-bottom-right-radius: 40rpx;
					border-bottom-left-radius: 20rpx;
					background-color: rgba(234, 171, 78, 0.35);
					line-height: 42rpx;
					text-align: center;
					color: rgba(255, 173, 4, 1);
					font-size: 24rpx;
				}

				.list-item-row-icon {
					width: 38rpx;
					height: 38rpx;
					margin-right: 10rpx;
					display: flex;
					justify-content: center;
					align-items: center;
				}

				.list-item-row-title,
				.list-item-row-value {
					font-size: 24rpx;
					font-weight: 400;
					color: #101317;
					line-height: 38rpx;
				}

			}
		}

		.list-item-btn {
			width: 36rpx;
			height: 36rpx;
			margin-top: 56rpx;
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.list-item-tab {
			width: 132rpx;
			height: 56rpx;
			text-align: center;
			line-height: 56rpx;
			background-color: rgba(69, 145, 254, 0.4);
			position: absolute;
			top: 0;
			right: 0;
			border-top-right-radius: 26rpx;
			border-bottom-left-radius: 20rpx;
		}

		.list-item-tab-text {
			font-size: 26rpx;
			color: rgba(69, 145, 254, 1)
		}
	}

	.nav-right-image {
		width: 80rpx;
		height: 80rpx;
		margin-left: 15px;
	}

	.fun-wrap {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background-color: rgba(3, 3, 3, 0.28);
		z-index: 10000;
	}

	.fun-box {
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		align-items: center;
		flex-wrap: wrap;
		width: 556rpx;
		height: 400rpx;
		padding: 10px 0 0 0;
		border-top-left-radius: 42rpx;
		border-bottom-left-radius: 42rpx;
		border-bottom-right-radius: 42rpx;
		position: absolute;
		right: 74rpx;
		background-color: #FFFFFF;
	}

	.fun-item {
		width: 185rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}

	.fun-icon {
		width: 92rpx;
		height: 92rpx;
		margin-bottom: 22rpx;
	}

	.cu-form-group {
		background-color: transparent;
	}

	::v-deep {
		.cu-form-group uni-picker .picker {
			color: #FFFFFF;
		}

		.cu-form-group uni-picker::after {
			opacity: 0;
		}
	}

	.listText {
		font-size: 26rpx;
		font-weight: 400;
		color: #000000;
	}

	.boxList {
		margin-top: 20px;
		background-color: #F9F9F9;
		border-radius: 15px;
		padding: 20px;
	}
	.textClass{
		margin-top:10px;
	}
</style>
